<?php

class Z
{    
    const COND_AND = 'and';
    const COND_OR = 'or';
    
    static public function dump($val)
    {
	echo '<pre>';
	print_r($val);
	echo '</pre>';
	die;
    }
    static public function flush()
    {
	Yii::app()->memcache->flush();
    }
    static public function isUnempty($arr, $key, $cond = 'and')
    {
	if (!$arr) {
	    return false;
	}
	return ($cond = self::COND_AND 
		? isset($arr[$key]) && !empty($arr[$key]) 
		: isset($arr[$key]) || !empty($arr[$key]));
    }
    
    static public function isEmpty($arr, $key, $cond = 'and')
    {
	if (!$arr) {
	    return false;
	}
	return ($cond = self::COND_AND 
		? !isset($arr[$key]) && empty($arr[$key]) 
		: !isset($arr[$key]) || empty($arr[$key]));
    }
}